added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CSTabbedWebBrowser / DWebBrowserEvent2Helper.cs
blob283afab209e86a879722d4ac2d44ce4994d982d2
1 /****************************** Module Header ******************************\
2 * Module Name: WebBrowser2EventHelper.cs
3 * Project: CSTabbedWebBrowser
4 * Copyright (c) Microsoft Corporation.
5 *
6 * The class WebBrowser2EventHelper is used to handle the NewWindow3 event
7 * from the underlying ActiveX control by raising the NewWindow3 event
8 * defined in class WebBrowserEx.
9 *
10 * Because of the protected method WebBrowserEx.OnNewWindow3, this
11 * class is defined inside the class WebBrowserEx.
13 * This source is subject to the Microsoft Public License.
14 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
15 * All other rights reserved.
17 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
18 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
20 \***************************************************************************/
22 using System;
23 using System.Runtime.InteropServices;
25 namespace CSTabbedWebBrowser
27 public partial class WebBrowserEx
29 private class DWebBrowserEvent2Helper
30 : StandardOleMarshalObject, DWebBrowserEvents2
32 private WebBrowserEx parent;
34 public DWebBrowserEvent2Helper(WebBrowserEx parent)
36 this.parent = parent;
39 /// <summary>
40 /// Raise the NewWindow3 event.
41 /// If an instance of WebBrowser2EventHelper is associated with the underlying
42 /// ActiveX control, this method will be called When the NewWindow3 event was
43 /// fired in the ActiveX control.
44 /// </summary>
45 public void NewWindow3(ref object ppDisp, ref bool Cancel, uint dwFlags,
46 string bstrUrlContext, string bstrUrl)
48 var e = new WebBrowserNewWindowEventArgs(bstrUrl, Cancel);
49 this.parent.OnNewWindow3(e);
50 Cancel=e.Cancel;